﻿
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-collapse" lay-accordion="">
                        <div class="layui-colla-item">
                            <!--搜索区域-->
                            <h2 class="layui-colla-title">筛选查询</h2>
                            <div class="layui-colla-content layui-show">
                                <div class="layui-card">
                                    <form class="layui-form" lay-filter="SearchForm" id="SearchForm" autocomplete="off">
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">项目名称：</label>'
                                                <div class="layui-input-inline">
                                                    <input type="text" name='ProjectName' placeholder='项目名称' class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">方法标识：</label>'
                                                <div class="layui-input-inline">
                                                    <input type="text" name='ActionTag' placeholder='方法标识' class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">异常信息：</label>'
                                                <div class="layui-input-inline">
                                                    <input type="text" name='Content' placeholder='异常信息' class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">接口地址：</label>'
                                                <div class="layui-input-inline">
                                                    <input type="text" name='ApiPath' placeholder='接口地址' class="layui-input">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">开始时间:</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" class="layui-input" name='sCreatedOn' id="sCreatedOn" placeholder="yyyy-MM-dd">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label">结束时间:</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" class="layui-input" name='endDate' id="endDate" placeholder="yyyy-MM-dd">
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label"></label>

                                                <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="Search">搜索</button>
                                                <button class="layui-btn layui-btn-primary" id="Reset">重置</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-card">
                <div class="layui-card-body">
                    
                    <div style="margin-top: 10px;" id="AutoTablediv">
                        <!-- 加载列表 -->
                        <table class="layui-hide" style="width:100%" id="ListTable" lay-filter="ListTable"></table>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>


<script src="/Scripts/common.js?v=4"></script>
<script>
    var form
    var table
    //接收table 列数组
    var colArry = [{ "field": "Env", "title": "环境", "align": "center", "hide": true }, { "field": "RecordStatus", "title": "状态", "align": "center", "hide": true }, { "field": "ProjectName", "title": "项目名称", "align": "center", "hide": false }, { "field": "ActionTag", "title": "方法标识", "align": "center", "hide": false }, { "field": "Content", "title": "异常信息", "align": "center", "hide": false }, { "field": "ApiPath", "title": "接口地址", "align": "center", "hide": false }, { "field": "Level", "title": "等级", "align": "center", "hide": false }, { "field": "ID", "title": "主键", "align": "center", "hide": true }, { "field": "CreatedBy", "title": "创建人", "align": "center", "hide": false }, { "field": "ExceptionType", "title": "异常类型", "align": "center", "hide": false }, { "field": "CreatedOn", "title": "创建时间", "align": "center", "hide": false }]
    //日期控件id 数组
    var dateList = ["#sCreatedOn","#endDate"]
   

    //获取列表地址
    var getUrl = "/SysLogNew/GetList"
   

    layui.use(['laydate', 'table', 'form'], function () {
        var laydate = layui.laydate;
        var form = layui.form,
            table = layui.table

        form.render("select");
        //执行一个laydate实例
        for (var index = 0; index < dateList.length; index++) {
            laydate.render({
                elem: dateList[index] //指定元素
            });
        }
        //重置
        $(document).on('click', '#Reset', function () {
            $('#SearchForm')[0].reset();
            form.render(null, 'SearchForm');
            return false;
        });
        //查询
        form.on('submit(Search)', function (data) {

            //执行重载
            table.reload(tableId, {
                page: {
                    curr: 1 //重新从第 1 页开始

                },
                where: data.field
            }, 'data');

            return false;

        });
        tableId = "ListTable";

        InitTable(colArry);

        function InitTable(arry) {
 
            //列表 初始化
            table.render({
                elem: '#' + tableId,
                url: getUrl,
                method: 'post',
                headers: setTableHeader(),
                contentType: "application/json",
                dataType: "json",
                cols: [
                    arry
                ],
                page: true,
                where: {
                    dt: new Date()
                },
                done: function (res, curr, count) {

                }
            });
        }

         
    }); 

</script>
